package com.ruoyi.perfomance.controller;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.service.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.perfomance.domain.ScBaseDaily;
import com.ruoyi.perfomance.service.IScBaseDailyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

import javax.annotation.Resource;

/**
 * 日报管理Controller
 * 
 * @author mazheng
 * @date 2021-08-13
 */
@Api("日报管理Controller")
@RestController
@RequestMapping("/perfomance/daily")
public class ScBaseDailyController extends BaseController
{
    @Autowired
    private IScBaseDailyService scBaseDailyService;

    /**
     * 查询日报管理列表
     */
    @PreAuthorize("@ss.hasPermi('perfomance:daily:list')")
    @GetMapping("/list")
    public TableDataInfo list(ScBaseDaily scBaseDaily)
    {
        startPage();
        List<ScBaseDaily> list = scBaseDailyService.selectScBaseDailyList(scBaseDaily);
        return getDataTable(list);
    }

    /**
     * 导出日报管理列表
     */
    @PreAuthorize("@ss.hasPermi('perfomance:daily:export')")
    @Log(title = "日报管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ScBaseDaily scBaseDaily)
    {
        List<ScBaseDaily> list = scBaseDailyService.selectScBaseDailyList(scBaseDaily);
        ExcelUtil<ScBaseDaily> util = new ExcelUtil<ScBaseDaily>(ScBaseDaily.class);
        return util.exportExcel(list, "日报管理数据");
    }

    /**
     * 获取日报管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('perfomance:daily:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {AjaxResult ar = AjaxResult.success(scBaseDailyService.selectScBaseDailyById1(id));
        return ar;
    }

    /**
     * 新增日报管理
     */
    @PreAuthorize("@ss.hasPermi('perfomance:daily:add')")
    @Log(title = "日报管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ScBaseDaily scBaseDaily)
    {
        return toAjax(scBaseDailyService.insertScBaseDaily(scBaseDaily));
    }



    /**
     * 修改日报管理
     */
    @PreAuthorize("@ss.hasPermi('perfomance:daily:edit')")
    @Log(title = "日报管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ScBaseDaily scBaseDaily)
    {
        return toAjax(scBaseDailyService.updateScBaseDaily(scBaseDaily));
    }

    /**
     * 删除日报管理
     */
    @PreAuthorize("@ss.hasPermi('perfomance:daily:remove')")
    @Log(title = "日报管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(scBaseDailyService.deleteScBaseDailyByIds(ids));
    }


    /**
     * 查询相关数据HASHMap
     * 查询日报管理列表
     */
    @ApiOperation(value = "查询相关数据HASHMap",tags = {"查询"}, notes = "结果hashMap")
    @PreAuthorize("@ss.hasPermi('perfomance:daily:list')")
    @ApiImplicitParam(name = "scBaseDaily", value = "日报信息查询", dataType = "ScBaseDaily")
    @GetMapping("/listh")
    public TableDataInfo listhashmap(ScBaseDaily scBaseDaily)
    {
        startPage();

        return getDataTable(scBaseDailyService.selectScBaseDailyListHashMap(scBaseDaily));
    }
}
